#ifndef PLAYSCENE_H
#define PLAYSCENE_H

#include <QMainWindow>
#include<map.h>
#include<QTimer>
#include<01Config.h>
#include<QPainter>
#include<heroplane.h>
#include<QMouseEvent>
#include<QPushButton>
#include<bullet.h>
#include<upgradeicon.h>
#include<enemyplane.h>
#include<QtDebug>
#include<bomb.h>
#include<QLabel>
#include<QLCDNumber>
#include<QBrush>
#include<QPropertyAnimation>
#include<boss.h>
#include<wingplane.h>
#include<gold.h>
#include<QSound>
#include<QMediaPlayer>
#include<QMediaPlaylist>

class Playscene : public QMainWindow
{
    Q_OBJECT
public:
    explicit Playscene(QWidget *parent = nullptr);
    Map m_map;
    //初始化场景

    void initSence();

    //定时器
    QTimer m_timer;

    //启动游戏
    void playGame();

    //更新所有元素坐标
    void updatePosition();

    //绘制到屏幕中
    void paintEvent(QPaintEvent *event);

    //鼠标移动
    void mouseMoveEvent(QMouseEvent *event);


    //飞机
    HeroPlane m_hero;

    //僚机左
    WingPlane m_Wing_left;

    //僚机右
    WingPlane m_Wing_right;

    //僚机伤害
    int Wing_Hurt=0;

    //战机血条
    QPixmap pix_blood;
    int m_blood_num=200;
    //战机蓝条
    QPixmap pix_bule;
    int m_blue_num=HERO1_BLUE;
    //技能图标
    QPushButton *big_btn;
    //是否开启大招
    bool  is_big=0;


    //增加子弹
    UpgradeIcon m_UpAdds;
    //回血
    UpgradeIcon m_BackBloods;
    //护盾
    UpgradeIcon m_Defends;

    //升级子弹图标出场间隔
    int m_UpAdd_Recorder;
    //回血图标出场间隔
    int m_Back_Blood_Recorder=0;
    //护盾图标出场间隔
    int m_Defend_Recorder=0;

    //升级子弹出场
    void  Upaddscence();
    //回血图标出场
    void  Back_Blood_scence();
    //护盾图标出场
    void  Defend_scence();



    //金币
    Gold m_golds[GOLD_NUM];
    //金币出场
    void  Gold_Scene();
    //金币出场时间间隔
    int Gold_Recorder=0;
    //金币个数
    int m_gold_num=0;
    //金币记录
    QLCDNumber *Gold=NULL;

    //碰撞检测
    void  collisionDetection();

    //敌机一
    EnemyPlane m_Enemy01s[ENEMY01_NUM];

    //敌机一出场间隔
    int m_Enemy01_Recorder;

    //敌机一出场
    void  Enemy01scence();


    //敌机三
    EnemyPlane m_Enemy03s[ENEMY03_NUM];

    //敌机三出场间隔
    int m_Enemy03_Recorder;

    //敌机三出场
    void  Enemy03scence();


    //boss1
    Boss  m_Boss01;

    //boss出场
    void Boss_scence();

    //返回
    QPushButton*back_btn;

    //爆炸数组
    Bomb m_bombs[BOMB_NUM];

    //爆炸音效
    QSound *bomb_music01;
    QSound *bomb_music02;

    //击中效果
    QLabel m_lable;

    //得分记录
    QLCDNumber *score=NULL;
    int num=0;

    //游戏结束显示
    QLabel *overlable=NULL;
    //警告显示
    QLabel *warnlabel=NULL;
    //重新开始
    QPushButton*againbtn;


    //背景音乐
    QSound*back_music;

    //按钮点击音效
    QSound*btn_music;

    //吸收金币音效
    QSound*gold_music;

    //升级音效
    QSound*up_music;

    //警告音效
    QSound*alarm_music;

    //游戏结束音效
    QSound*over_music;










signals:
    //返回主界面信号
   void  returnmain();
   //爆炸信号
   void  explosion();
   //boss爆炸
   void  boss_explosion();
   //释放技能
   void release_big();
   //金币
   void  gold_add();
};

#endif // PLAYSCENE_H
